home *** CD-ROM | disk | FTP | other *** search
- /*
- * Wish List Module - Version 1.5 - By Scott Szretter
- *
- * (C)1991 Scott Szretter - Please see the file "COPYRITE.SPS"
- *
- * ))) Version Changes (((
- * --Version-------------Notes-----------------------------------------------------------------
- * 1.0 -> 1.1 ... List was not being built properly-fixed & other small code cleanups...
- * 1.1 -> 1.2 ... Added some features (sysop display, help,Intro,date) & cleanup...
- * 1.2 -> 1.3 ... Fixed bug with wish being added to INTRO file........
- * 1.3 -> 1.4 ... Added better err reporting, Better user interface, fixed POSSIBLE bug.
- * 1.4 -> 1.5 ... Added level/alt wishlist stuff...
- *
- * This program may not be sold for profit!
- * The source code is being release for educational purposes only.
- * I take no responsibility for any damage resulting from this code.
- */
- #define INMAIN
- #include <SetUpA4.h>
- #include "MUBBS Module.h"
- pascal void main (mode1,G1,P1)
- int mode1;
- struct GS *G1;
- Ptr *P1;{
- Handle temph;
- float version = 0.5; /* version of MUBBS */
- RememberA0(); SetUpA4();
- asm { _RecoverHandle }; asm {move.l a0,temph}; HLock(temph); /* lock our module. */
- G=G1;
- mode[u]=mode1;
-
- switch (mode[u]) {
- case 2:
- Wish();
- G->moduleresult=0;
- break;
- case 98:
- versionck(version);
- break;
- case 0:
- strcpy (G->programmer,"Scott Szretter");
- G->moduleresult=0;
- break;
- default:
- G->moduleresult=1;
- break;};
- HUnlock(temph); /* unlock module.*/
- RestoreA4();}
-
- /**** * * * -Wish- * * * * ****/
- Wish() {
- FILE *stream;
- char filename[65];
- char temp[43];
- char datetime[25];
- char stemp[255];
- int SMenu,W,itemp;
- if (!G->online[u]) return; /* Log out if hang up */
- SMenu=TRUE;
- W=TRUE;
- strcpy(filename,":wish:");
- strcat(filename,G->modulename[u]);
- strcat(filename,".intro");
- print("C> Line %d %s, at: %s\n",(u+1),G->username[u],G->modulename[u]);
- loguser(G->modulename[u]); /* write to log file */
- send (G->CR[u]);
- sendtext(filename);
- while (W=TRUE) {
- if (!G->online[u]) return;
- if (SMenu=TRUE){
- send("]] *** WishList Menu *** ");
- send (G->CR[u]);
- if (!(cmd1(">> Display, Add, Help, Quit, Logoff "))) G->online[u]=FALSE;
- SMenu=FALSE; }
- send(G->CR[u]);
- if (G->input[u] =='Q') {
- W=FALSE;
- print("C> Exiting Wishlist -> ",G->username[u]);
- send("] Thank You for using WishList!");
- return;}
- if (G->input[u] =='L') {
- W=FALSE;
- G->online[u]=FALSE;}
- if (G->input[u] =='H') {
- strcpy(filename,":wish:");
- strcat(filename,G->modulename[u]);
- strcat(filename,".help");
- send (G->CR[u]);
- sendtext(filename);
- send ("]WishList 1.5 By - Scott Szretter");
- SMenu=TRUE;
- W=TRUE;}
- if (G->input[u] =='D'){
- if(G->userpriv[u] > 4) {
- send("]Display the Alternate wish list ");
- if (!(cmd1("Y/N?"))) G->online[u]=FALSE;
- send(G->CR[u]);
- if (G->input[u] =='Y') {
- strcpy(filename,":wish:");
- strcat(filename,G->modulename[u]);
- strcat(filename,".alt");
- send (G->CR[u]);
- sendtext(filename);}} /* UserPriv & Y to send */
- if (G->input[u] =='N') {
- strcpy(filename,":wish:");
- strcat(filename,G->modulename[u]);
- strcat(filename,".info");
- send (G->CR[u]);
- sendtext(filename);}} /* D!*/
- if (G->input[u] =='A'){
- if(G->userpriv[u] > 4) {
- send("]Display the Alternate wish list ");
- if (!(cmd1("Y/N?"))) G->online[u]=FALSE;
- send(G->CR[u]);
- if (G->input[u] =='Y') {
- send("Please enter your wish (40 characters maximum)");
- send("] !--------!---------!---------!---------!");
- send("]>");
- portsin(temp, 41);
- send(G->CR[u]);
- if (temp[0] == 0){
- send("]Aborted...");
- send(G->CR[u]);
- return;} /* temp=0 */
- strcpy(filename,":wish:");
- strcat(filename,G->modulename[u]);
- strcat(filename,".alt");
- if ((stream = fopen(filename, "a")) == NULL) { /* Open the file */
- send("]FILE ERROR cannot open %s ]", filename);
- print("\nFile ERROR Cannot Open %s W",filename);
- return;} /* stream */
- gettime("%m/%d/%y",datetime); /* gets the date in m/d/y */
- if (fprintf(stream,"%-41s %-9s %-29s\r",temp,datetime,G->username[u])==EOF) print("bad fprintf conversion\n");
- fclose(stream);
- send(G->CR[u]);
- send("Your wish has been added to the WishList!");
- print("C> Added to ALTERNATE WishList -> ",G->username[u]);}} /* UserPriv & Y */
- if (G->input[u] =='N') {
- send("Please enter your wish (40 characters maximum)");
- send("] !--------!---------!---------!---------!");
- send("]>");
- portsin(temp, 41);
- send(G->CR[u]);
- if (temp[0] == 0){
- send("]Aborted...");
- send(G->CR[u]);
- return;}
- strcpy(filename,":wish:");
- strcat(filename,G->modulename[u]);
- strcat(filename,".info");
- if ((stream = fopen(filename, "a")) == NULL) { /* Open the file */
- send("]FILE ERROR cannot open %s ]", filename);
- print("\nFile ERROR Cannot Open %s W",filename);
- return;}
- gettime("%m/%d/%y",datetime); /* gets the date in m/d/y */
- if (fprintf(stream,"%-41s %-9s %-29s\r",temp,datetime,G->username[u])==EOF) print("bad fprintf conversion\n");
- fclose(stream);
- send(G->CR[u]);
- send("Your wish has been added to the WishList!");
- print("C> Added to WishList -> ",G->username[u]);}}
- }
- }